<%-- 
    Document   : updateComment
    Created on : 13-08-2014, 22:29:04
    Author     : NGOCLINH-PC
--%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="Data.Member"%>
<%@page import="Data.Comment"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Data.RoleType"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<div class="tablemember">
    <form action="../MemberPR" method="post" name="formmember">   
        <h2 style="padding: 10px; color: #999;">Update Member</h2>
        <hr />
        <table width="100%" border="0" align="center" cellpadding="14" cellspacing="14">
            <%
                if (request.getParameter("EmemID") != null) {
                    Member ct = new Member();
                    int payID = Integer.parseInt(request.getParameter("EmemID"));
                    ArrayList<Member> a = ct.MselectById(payID);
                    if (a.size() > 0) {
                        for (int i = 0; i < a.size(); i++) {
                            Member pay = a.get(i);
                            SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy");
            %>
            <tr>
                <td width='10%'>Member ID:</td>
                <td width='50%'><label  for='txtcateid'></label>
                    <% out.print("<input type='text' readonly name='txtcustomer' id='txtcustomer' value='" + pay.getMemberID() + "' /></td>");%>
            </tr>

            <tr>
                <td width="10%">Member Name:</td>
                <td width="57%"><label for="txtname"></label>
                    <% out.print("<input type='text' readonly name='txtname' id='txtname' value='" + pay.getMemberName() + "'/></td>");%>
            </tr>
            <tr>
                <td width="10%">Email:</td>
                <td width="57%"><label for="txtemail"></label>
                    <% out.print("<input required  readonly type='email' name='txtemail' id='txtemail' value='" + pay.getEmail() + "'/></td>");%>
            </tr>
            <tr>
                <td width="10%">Phone:</td>
                <td width="57%"><label for="txtphone"></label>
                    <% out.print("<input type='text' readonly name='txtphone' id='txtphone' value='" + pay.getPhone() + "'/></td>");%>
            </tr>
            <tr>
                <td width="10%">Gender:</td>
                <td width="57%"><label for="txtgender"></label>
                    <select name="txtgender"  disabled="disabled" class="txtgender">
                        <% if (pay.getGender().equalsIgnoreCase("1")) {
                                out.print("<option value='1' selected='selected'>Male</option>");
                                out.print("<option value='2'>Female</option>");
                            } else {
                                out.print("<option value='1'>Male</option>");
                                out.print("<option value='2' selected='selected'>Female</option>");
                            }
                        %>
                    </select>
            </tr>

            <tr>
                <td width="10%">Address:</td>
                <td width="57%"><label for="txtaddress"></label>
                    <% out.print("<textarea readonly name='txtaddress'>" + pay.getAddress() + "</textarea></td>");%>
            </tr>
            <tr>
                <td width="10%">Birthday:</td>
                <td width="57%"><label for="txtbrithday"></label>
                    <% out.print("<input  readonly name='txtbrithday'  value='" + sdf.format(pay.getBirthday()) + "'/></td>");%>
            </tr>
            <tr>
                <td width="10%">Role:</td>
                <td width="57%"><label for="txtrole"></label>
                    <select name="txtrole" class="txtrole">
                        <%
                            String str = "";
                            RoleType r = new RoleType();
                            ArrayList<RoleType> ar = r.Rselect();
                            for (int j = 0; j < ar.size(); j++) {
                                RoleType rol = ar.get(j);

                                if (pay.getRoleID() == rol.getRoleID()) {
                                    str += "<option value='" + rol.getRoleID() + "' selected='selected'>" + rol.getRoleName() + "</option>";
                                } else {
                                    str += "<option value='" + rol.getRoleID() + "'>" + rol.getRoleName() + "</option>";
                                }
                            }
                            out.print(str);
                        %>
                    </select>
                </td>
            </tr>

            <tr>
                <td>Status:</td>
                <td>
                    <%
                        if (pay.getStatus() == 1) {
                            out.print("<input type='radio' name='radio1' id='rdtrangthai' value='1' checked />Show");
                            out.print("<input type='radio' name='radio1' id='rdtrangthai' value='0' />Hidden");
                        } else {
                            out.print("<input type='radio' name='radio1' id='rdtrangthai' value='1' />Show");
                            out.print("<input type='radio' name='radio1' id='rdtrangthai' value='0' checked />Hidden");
                        }

                    %>
                </td>
            </tr>
            <tr align="">
                <td></td>
                <td ><input type="submit" name="btnsubmit" id="btnsubmit" value="Submit" />
                </td>
            </tr>
            <%
                        }
                    }
                } else {
                }
            %>  
        </table>
    </form>
</div>